package demo;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/7/20-07-20-15:39
 * @Description：demo
 */
public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.print("请输入第一个数组的大小：");
        int n1 = sc.nextInt();
        int[] arr1 = new int[n1];
        System.out.println("请输入数组一的" + n1 + "个值：");
        for (int i = 0; i < n1; i++) {
            arr1[i] = sc.nextInt();
        }

        System.out.print("请输入第二个数组的大小：");
        int n2 = sc.nextInt();
        int[] arr2 = new int[n2];
        System.out.println("请输入数组一的" + n2 + "个值：");
        for (int i = 0; i < n2; i++) {
            arr2[i] = sc.nextInt();
        }
        if(EqualsOfArray(arr1, arr2)){
            System.out.println("数组一：" + Arrays.toString(arr1) + "  ==  数组二：" + Arrays.toString(arr2));
        }else{
            System.out.println("数组一：" + Arrays.toString(arr1) + "  !=  数组二：" + Arrays.toString(arr2));
        }
    }

    public static boolean EqualsOfArray(int[] arr1, int[] arr2) {
        if(arr1.length != arr2.length){
            return false;
        }
        for (int i = 0; i < arr1.length && i < arr2.length; i++) {
            if(arr1[i] != arr2[i]){
                return false;
            }
        }
        return true;
    }


}

